.section .text, "ax"
.arm
.global jump
.type jump, #function
jump:
    mov pc, r0
.size jump, . - jump

.global jump64
.type jump64, #function

jump64:
    mov r4, r3
    mov r3, r2
    mov r2, r1
    mov r1, r0
    ldr r0, =0x82000200
    smc #0
    b .
.size jump64, . - jump64

.global jumparch64
.type jumparch64, #function
jumparch64:
    MOV r4, r1   /* r4 argument */
    MOV r5, r2   /* r5 argument */
    MOV r6, r0   /* keep Kernel jump addr */

    /* setup the reset vector base address after warm reset to Aarch64 */
    /* ldr r1,=RVBADDRESS_CPU0 */
    /* ldr r1,[r1] */
    /* LDR r0, =0x4000C000 */
    //LDR r0, =0x00001000
    LDR r0, =0x40000000
    LDR r1, =0x10200038
    str r0,[r1]

    /* setup the excution state after warm reset: 1:Aarch64, 0:Aarch32 */
    MRC p15,0,r0,c12,c0,2
    orr r0, r0, #1
    MCR p15,0,r0,c12,c0,2
    DSB
    ISB

    /* do warm reset:reset request */
    MRC p15,0,r0,c12,c0,2
    orr r0, r0, #2
    MCR p15,0,r0,c12,c0,2
    DSB
    ISB

    /* set r0 as 0xC000_0000 for ATF OP code check */
    MOV r0, r4
    MOV r1, r5
    MOV r2, r0

1:
    /* enter WFI to request a warm reset */
    WFI
    B 1b
.size jumparch64, . - jumparch64

.align 8
.type test64, #function
.global test64
test64:
.long 0x14000000
.size test64, . - test64
